import { BasicColumn, FormSchema } from '/@/components/Table';
import { ref } from 'vue';
import {dateRangeProcessing} from '/@/utils/dateUtil';

export let dates = ref([null, null]);
const getRangeDate = (pickerdates) => {
  dates = dateRangeProcessing(pickerdates);
};

export const columns: BasicColumn[] = [
  {
    title: 'id',
    dataIndex: 'id',
    ifShow: false,
  },
  {
    title: '订单号',
    dataIndex: 'orderId',
    width: 100,
  },
  {
    title: '订单行号',
    dataIndex: 'lineNo',
    width: 100,
  },
  {
    title: 'SAP订单号',
    dataIndex: 'orderIdSap',
    width: 100,
  },
  {
    title: '上传状态',
    dataIndex: 'uploadStatus',
    width: 100,
  },
  {
    title: 'SAP订单号',
    dataIndex: 'realName',
    width: 100,
  },
  {
    title: '市场部',
    dataIndex: 'orgName',
    width: 100,
  },
  {
    title: '经销商',
    dataIndex: 'dealerName',
    width: 100,
  },
  {
    title: '子品牌',
    dataIndex: 'subBrandName',
    width: 100,
  },
  {
    title: '可耦合车辆数',
    dataIndex: 'ouheNum',
    width: 100,
  },

  {
    title: '产品线',
    dataIndex: 'zcpx',
    width: 100,
  },
  {
    title: '动力',
    dataIndex: 'zfdjxh',
    width: 100,
  },
  {
    title: 'G表号/基础车型',
    dataIndex: 'productG',
    width: 100,
  },
  {
    title: '资源状态',
    dataIndex: 'status',
    width: 100,
  },
  {
    title: '价格',
    dataIndex: 'price',
    width: 100,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    label: '订单号',
    field: 'orderId',
    component: 'Input',
  },
  {
    label: '提报时间',
    field: 'dateTime',
    component: 'RangePicker',
    required: true,
    componentProps: () => {
      return {
        valueFormat: 'YYYY-MM-DD',
        format: 'YYYY-MM-DD',
        style: { width: '100%' },
        getPopupContainer: () => document.body,
        onChange: (dates, datestrs) => {
          console.log(dates);
          getRangeDate(datestrs);
        },
      };
    },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: 'id',
    component: 'Input',
    show: false,
  },
  {
    label: '用户名',
    field: 'username',
    component: 'Input',
    required: true,
  },
  // {
  //   label: '密码',
  //   field: 'userPassword',
  //   component: 'Input',
  //   required: true,
  // },
  {
    label: '姓名',
    field: 'realName',
    component: 'Input',
    required: true,
  },
  {
    label: '状态',
    field: 'status',
    component: 'Input',
    required: true,
  },
  {
    label: '电子邮件',
    field: 'email',
    component: 'Input',
    required: true,
  },
  // {
  //   label: 'CRM公司编码',
  //   field: 'companyCodeCrm',
  //   component: 'Input',
  //   required: true,
  // },
];
